package com.java.control.impl;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;

import com.java.control.AbstractAdminFormController;
import com.java.entity.Company;
import com.java.service.CompanyService;

/**
 * 公司编辑
 * @author wqf
 * @version  Nov 23, 2011 1:10:42 PM
 */
public class CompanyEditController extends AbstractAdminFormController{

	public CompanyEditController(){
		this.setCommandClass(Company.class);
	}
		
	protected void modifySubmit(HttpServletRequest request,HttpServletResponse response,Object command,BindException errors) throws Exception{		
		Company obj = (Company)command;
		
		this.companyService.updateCompany(obj);
		
		request.setAttribute("operation", "modify");
		request.setAttribute("id", obj.getId());
	}
		
	protected Object getCommandDataForModify(HttpServletRequest request){
		Company company = this.companyService.getCompanyById(1l);		
		return company;
	}
	
		
	public CompanyService companyService;

	public CompanyService getCompanyService() {
		return companyService;
	}

	public void setCompanyService(CompanyService companyService) {
		this.companyService = companyService;
	}

	
}
